﻿using ProgramCat.FiddlerExtension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MSScriptControl;
using V8.Net;
using System.IO;

namespace V8Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //V8Engine v8Engine = new V8Engine();
            //InternalHandle internalHandle = v8Engine.Execute("function aaa(a){return {x:1,y:2};}function aaa11(x) {}");

            ////string[] aaa = v8Engine.GlobalObject.GetPropertyNames();

            ////foreach (var item in aaa)
            ////{
            ////    Console.WriteLine(item);
            ////}
            //InternalHandle run = v8Engine.Compile("function aaa(a){return {x:1,y:2};}function aaa11(x) {}");
            //Console.WriteLine(run.Value.ToString());

            string a = "function aaa()1{return '1';}";
            //string jb = File.ReadAllText(@"D:\360MoveData\Users\unity\Desktop\精易助手\POST调试助手2.6\JsBeautify.txt");
            V8Engine v8_temp = new V8Engine();
            InternalHandle internalHandle1 = v8_temp.Execute(a);
            //InternalHandle Compile1 = v8_temp.Compile(jb);
            //Handle js_source_text = v8_temp.CreateValue(a);
            //Handle options = v8_temp.CreateValue("4");
            //InternalHandle internalHandle = v8_temp.GlobalObject.GetProperty("js_beautify");
            //Console.WriteLine(internalHandle.Call);
            //InternalHandle internalHandle1 = Compile1.Call("js_beautify", null, js_source_text, options);
            //Console.WriteLine(internalHandle1.Value.ToString());
            
            //InternalHandle internalHandle = v8_temp.GlobalObject.GetProperty("js_beautify");
            ////string js_beautify = string.Format("js_beautify('{0}','4')", a);
            ////InternalHandle internalHandle = v8_temp.Execute(js_beautify);
            //Handle js_source_text = v8_temp.CreateValue(jb);
            //Handle options = v8_temp.CreateValue("4");
            //InternalHandle ca = v8_temp.GlobalObject.Call("js_beautify", null, js_source_text, options);
            Console.WriteLine(internalHandle1.Value.ToString());
            Console.ReadKey();

           
        }
    }
}
